﻿using System;
using System.Xml.Linq;
using HigLabo.Net.Extensions;
using System.Collections.Generic;

namespace HigLabo.Net.Twitter
{
    /// <summary>
    /// 
    /// </summary>
    public class TrendLocation : ResponseObject
    {
        /// <summary>
        /// 
        /// </summary>
        public String Country { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public String CountryCode { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public String Name { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public Int32 ParentID { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public CodeName PlaceType { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public String Url { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public Int32 WoeID { set; get; }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="jsonText"></param>
        public TrendLocation(String jsonText)
        {
            this.SetProperty(jsonText);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="jsonText"></param>
        public override void SetProperty(string jsonText)
        {
            var d = this.SetData(jsonText);

            this.Country = d.ToString("country");
            this.CountryCode = d.ToString("countryCode");
            this.Name = d.ToString("name");
            this.ParentID = d.ToInt32("parentid") ?? this.ParentID;
            this.PlaceType = new CodeName(d.ToString("placeType"));
            this.Url = d.ToString("url");
            this.WoeID = d.ToInt32("woeid") ?? this.WoeID;
        }
    }
}
